<?php

class Core_Backend_Component_Article_View_Content_Edit extends Core_Backend_Component_Article_View_Content_Create {

    protected function buildToolbar($toolbar) {
        parent::buildToolbar($toolbar);
        $group = $toolbar->createGroup('preview');
        $group->addLink($this->getUrl(array('id' => $this->getModel()->getId()), 'preview'), $this->__('share.button.preview'), '_blank');
//        $group->addLink($this->getUrl(array('id'=>$this->getModel()->getId()), 'send'), $this->__('share.button.send'));

        if ($this->getIdentity()->isAllowAction('article_review')) {
        	$status = $this->getModel()->getStatus();
            $group = $toolbar->createGroup('status');
            if ($status != "draft") {
                if ($status != 'published') {
                    $group->addButton($this->__('share.button.publish'))
                            ->bindEvent('click', "submitPublish('" . $this->getForm()->getId() . "', '" . $this->getUrl(array('ids' => array($this->getModel()->getId()), 'status' => 'published'), 'review') . "')");
                }
                if ($status != 'forbidden') {
                    $group->addButton($this->__('share.button.forbid'))
                            ->bindEvent('click', "submitForbid('" . $this->getForm()->getId() . "', '" . $this->getUrl(array('ids' => array($this->getModel()->getId()), 'status' => 'forbidden'), 'review') . "')");
                }
            }
        }

//        if ($this->getIdentity()->isInRole('article_reviewer') && $this->getModel()->getStatus() == "published") {
//            $group = $toolbar->createGroup('forbid');
//            $group->addButton($this->__('share.button.forbid'))
//                    ->bindEvent('click', "submitForbid('" . $this->getForm()->getId() . "', '" . $this->getUrl(array('ids' => array($this->getModel()->getId())), 'forbid') . "')");
//        }
    }

    protected function buildForm($form) {

        parent::buildForm($form);
    }

}